import math

R = 6371  # 地球平均半径，单位：千米

longitude1 = 138.103
longitude2 = 138.044
latitude1 = 35.322
latitude2 = 35.304

# 计算经度差值对应的距离
long1_rad = math.radians(longitude1)
long2_rad = math.radians(longitude2)

dlon = long2_rad - long1_rad

a = math.sin(dlon / 2) ** 2
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
dlong_distance = R * c

# 计算纬度差值对应的距离
lat1_rad = math.radians(latitude1)
lat2_rad = math.radians(latitude2)

dlat = lat2_rad - lat1_rad

a = math.sin(dlat / 2) ** 2
c = 2 * math.atan2(math.sqrt(a), math.sqrt(1 - a))
dlat_distance = R * c

print(f"两个经度相差约：{dlong_distance} 千米")
print(f"两个纬度相差约：{dlat_distance} 千米")